package com.example.swagger.controller;

import com.example.swagger.model.ApiBaseDTO;
import com.example.swagger.model.UserSchema;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author <a href="xiaoymin@foxmail.com">xiaoymin@foxmail.com</a>
 * 2024/3/15 14:06
 * @since knife4j-spring-boot27-demo v1
 */
@Tag(name = "simple1")
@SecurityRequirement(name = "security_auth")     // swagger ui 类级别的安全认证
@RestController
@RequestMapping("/simple")
public class SimpleController {

    // 在 Operation 内部使用 security 定义方法级别的安全认证，使用 tags 定义标签
    @Operation(summary = "获取详情", description = "Returns a map of status codes to quantities",
            security = {@SecurityRequirement(name = "api_key") }, tags = { "store" })
    @GetMapping("/getOneDetailById")
    public ApiBaseDTO<UserSchema> getOneDetailById(@RequestParam(required = false) Integer id) {
        return null;
    }
}
